package com.ymatou.query.seller.trading.api.service;

import org.json.JSONObject;

import com.ymatou.iapi.trading.sellerquery2.parameter.resp.GetOrderTradeflowResp;
import com.ymt.base.YmatouBaseCall;
import com.ymt.core.tool.FormatUtil;
import com.ymttest.utils.EnvSetup;
/**
*获取单个订单信息Call
*FreeMaker Template自动生成代码
*/
public class GetOrderTradeflowCall extends YmatouBaseCall{
	private static String opurl ="api/OrderQuery/GetOrderTradeflow";
	
	public GetOrderTradeflowCall() {
		super(EnvSetup.getSystemUrl("api_seller_order_query"),opurl,"GET","PARAM");
	}
	@Override
	public void addDefHeader() {
		client.addHeader("Accept","text/xml,text/javascript,text/html,application/json");
		client.addHeader("Content-Type", "application/json; charset=UTF-8");
	}
	
	/**
     * 获取Code
     * 
     * @return
     */
    public String getCode() {
        String Code = null;
        try {
            Code = new JSONObject(getReturnData()).getString("Code");
        } catch (Exception e) {
            e.printStackTrace();
        }
        return Code;
    }

    /**
     * 获取BCode
     * 
     * @return
     */
    public int getBCode() {
        int BCode = -1;
        try {
            BCode = new JSONObject(getReturnData()).getInt("BCode");
        } catch (Exception e) {
            e.printStackTrace();
        }
        return BCode;
    }

    /**
     * 获取Msg
     * 
     * @return
     */
    public String getMsg() {
        String BCode = null;
        try {
            BCode = new JSONObject(getReturnData()).getString("Msg");
        } catch (Exception e) {
            e.printStackTrace();
        }
        return BCode;
    }

    /**
     * 获取Data
     * 
     * @return
     */
    public JSONObject getData() {
        JSONObject Data = null;
        try {
            Data = new JSONObject(getReturnData()).getJSONObject("Data");
        } catch (Exception e) {
            e.printStackTrace();
        }
        return Data;
    }
    /**
 	 * 获取退款订单资金信息
 	 * 
 	 * @return
 	 */
 	public GetOrderTradeflowResp getOrderTradeflowResp(){
 		return (GetOrderTradeflowResp) FormatUtil
				.GSONToObject(getData().toString(), GetOrderTradeflowResp.class);
 	} 	
}